<div data-hook='admin_store_credit_form_fields'>
  <%= f.field_container :amount, class: %w[form-group] do %>
    <%= f.label :amount, raw(Spree.t(:amount) + required_span_tag) %>
    <%= f.text_field :amount, class: 'form-control' %>
    <%= f.error_message_on :amount %>
  <% end %>
  <%= f.field_container :currency, class: %w[form-group] do %>
    <%= f.label :currency, raw(Spree.t(:currency) + required_span_tag) %>
    <%= f.select :currency, currency_options(f.object.currency) %>
    <%= f.error_message_on :currency %>
  <% end %>
  <%= f.field_container :category, class: %w[form-group] do %>
    <%= f.label :category, raw(Spree.t(:category) + required_span_tag) %>
    <%= f.select :category_id, options_from_collection_for_select(@credit_categories, :id, :name, f.object.category.try(:id)),
        { include_blank: true }, { class: 'select2 fullwidth', placeholder: Spree.t(:select_a_store_credit_reason) } %>
    <%= f.error_message_on :category %>
  <% end %>
  <%= f.field_container :memo, class: %w[form-group] do %>
    <%= f.label :memo, Spree.t(:memo) %>
    <%= f.text_area :memo, class: 'form-control' %>
    <%= f.error_message_on :memo %>
  <% end %>
</div>

<script>
  $('#store_credit_currency').select2();
</script>
